<form class="form-inline" method="get">

    <div class="form-group col-xs-4">
        {include file="public/areaSelector" province-name="pro" city-name="city" /}
    </div>

    <div class="form-group col-xs-4"  style="width: 20%;">
        <div class="col-xs-12">
            <input class="form-control" name="condition" value="{$condition}"
                   placeholder="商会名称">
        </div>
    </div>
    <div class="form-group col-xs-4" style="width: 20%;">
        <button type="submit" class="btn btn-success">
            搜索
        </button>

        <button type="button" class="btn btn-primary" onclick="modal('{:url(\'add\')}','添加商会')">
            添加商会
        </button>
    </div>
</form>

<hr>

<table class="table table-striped">
    <thead>
    <tr>
        <td>ID</td>
        <td>地区</td>
        <td>账号</td>
        <td>名称</td>
        <td>logo</td>
        <td>首页推荐</td>
        <td>排序</td>
        <td>编辑时间</td>
        <td>登录时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>
            <label class="label label-info">{:get_regionName($item['pro'])}-{:get_regionName($item['city'])}</label>
        </td>
        <td>
            <label class="label label-default">{$item.account}</label>
        </td>
        <td>
            <label class="label label-danger">{$item.title}</label>
        </td>
        <td>
            <a href="javascript:void(0);" onclick="ejectImg('{$item.avatar}','{$item.title}logo');">
                <img style="width: 80px;height: 80px;" src="{$item.avatar}" />
            </a>
        </td>
        <td>
            <?php
                    $is_recommend_1 = '推荐';
                    $is_recommend_0 = '不推荐';
                ?>
            {if $item["is_recommend"]}
            <label class="label label-success" data-toggle="ajaxSwitch" data-switch-status="1" data-reload="true"
                   data-switch-value-0="1|{$is_recommend_1}|label label-success|{:url('recommend',array('aid'=>$item['id'],'status'=>1))}"
                   data-switch-value-1="0|{$is_recommend_0}|label label-danger|{:url('recommend',array('aid'=>$item['id'],'status'=>0))}">{$is_recommend_1}</label>
            {else}
            <label class="label label-danger" data-toggle="ajaxSwitch" data-switch-status="0" data-reload="true"
                   data-switch-value-0="1|{$is_recommend_1}|label label-success|{:url('recommend',array('aid'=>$item['id'],'status'=>1))}"
                   data-switch-value-1="0|{$is_recommend_0}|label label-danger|{:url('recommend',array('aid'=>$item['id'],'status'=>0))}">{$is_recommend_0}</label>
            {/if}
        </td>
        <td>{$item.display_order}</td>
        <td>{$item.update_time|show_datetime}</td>
        <td>{$item.last_logintime|show_datetime}</td>
        <td>

            <div class="btn-group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    操作
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li>
                        <a href="javascript:void(0)" onclick="modal('{:url(\'edit\',array(\'id\'=>$item[\'id\']))}', '编辑商户')">
                            编辑
                        </a>
                    </li>
                    <li>
                        <a href="{:url('Department/index')}?bussiness_name={$item.id}">
                            组织架构
                        </a>
                    </li>
                    <li>
                        <a href="{:url('Notice/index')}?bussiness_name={$item.id}">
                            公告通知
                        </a>
                    </li>
                    <li>
                        <a href="{:url('Content/article')}?bussiness_name={$item.id}">
                            商会动态新闻
                        </a>
                    </li>
                    <!--<li>-->
                        <!--<a href="javascript:void(0)" data-toggle="confirm"-->
                           <!--data-title="删除商会"-->
                           <!--data-content="确认删除？请谨慎操作！"-->
                           <!--data-url="{:url('remove',array('id'=>$item['id']))}">-->
                            <!--删除-->
                        <!--</a>-->
                    <!--</li>-->


                    <li role="separator" class="divider"></li>
                </ul>
            </div>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>

<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {

        //获取分类
        $("#category-selector").select2({
            placeholder: "选择新闻分类",
            allowClear: true
        });
    });
</script>